cmake_minimum_required(VERSION 3.15)
project(crashpad_example LANGUAGES CXX)

# 设置项目源文件
set(SRC_FILES
    main.cpp
)

add_executable(${PROJECT_NAME} ${SRC_FILES})

target_include_directories (${PROJECT_NAME} PRIVATE  
    ${CMAKE_SOURCE_DIR}/mxcrashpad_handle
)
target_compile_definitions(${PROJECT_NAME} PRIVATE BUILD_CRASHHANDLER_STATIC)
target_link_libraries(${PROJECT_NAME} PRIVATE CrashHandler)

if(MSVC)
#静态编译库文件  
#target_compile_options(${PROJECT_NAME} PRIVATE $<IF:$<CONFIG:DEBUG>,/MTd,/MT>)
  target_compile_options(${PROJECT_NAME} PRIVATE /bigobj)
  target_compile_options(${PROJECT_NAME} PRIVATE "/utf-8")
  target_compile_options(${PROJECT_NAME} PRIVATE "/Zc:strictStrings-")
  target_link_options(${PROJECT_NAME} PRIVATE "LINKER:/IGNORE:4098")


  #add_definitions("-DUNICODE" "-D_UNICODE")
  #add_compile_options("$<$<C_COMPILER_ID:MSVC>:/utf-8>")
  #add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/utf-8>")
  add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/source-charset:utf-8>")
  add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/execution-charset:utf-8")
endif()

# 开启 C++17 支持
set_target_properties(${PROJECT_NAME} PROPERTIES
    CXX_STANDARD 17
    CXX_STANDARD_REQUIRED YES
)

# 输出最终路径调试
message("Final executable will be located in: ${CMAKE_BINARY_DIR}/${PROJECT_NAME}")
